class MyArray<T>{
    public Object[] array=new Object[3];
    public void setArray(int pos,T val){
        array[pos]=val;
    }
    public T getVal(int pos){
        return (T)array[pos];
    }
}
public class Main {
    public static void main(String[] args) {
        MyArray<Integer> myArray1=new MyArray<Integer>();
        myArray1.setArray(0,19);
        Integer val=myArray1.getVal(0);
        System.out.println(val);
        MyArray<String> myArray2=new MyArray<>();
        myArray2.setArray(1,"hello");
        String str= myArray2.getVal(1);
        System.out.println(str);
    }
}